

var toindites = new Toindites();
mui.plusReady(toindites.dealHref);



function refresh(){
	try{
		//刷新后显示综合排序、发电量、装机容量
		if($("#sliderSegmentedControl").css("display") == 'none') {
			if($("#search").val()=="") {
				$(".searchDiv").hide();
				$("#sliderSegmentedControl").show();
			}
		}
		
		allpsData("synthesis");
		allpsData("daycap");
		allpsData("capacity");
		}catch(e){
	}
}

$(function(){
	try{
	allpsData("synthesis");
	allpsData("daycap");
	allpsData("capacity");
	}catch(e){
	
	}
});



var dataHand = new AjaxHandler();
var search="";
function allpsData(id){
	$.proAjax({
		url:"/mobile/listpses",
		data:{search:search,sort:$("#"+id).find("#sort").text(),order:"desc"},
		success: function (data){
			dataHand.arrayAddToHtml(id,data,null,function(elm,datas){
				elm.find("#imgsrc").attr("src",serverHost+datas.imgsrc);
				elm.find("#psstateimg").attr("src",datas.psstateimg);
				elm.find("#w-path").attr("src",datas['w-path']);
				elm.find("#w-path").attr("title",datas.weather);
				(function(m,d){
					m.on("tap",function(e){
						router.href("allStation.html",{psid:d});
					})
				}(elm,datas.psid))
			});
			toindites.dealHref();
		}
	});
}
//查询对对a标签进行监听
var id="#tabs-order"
mui("#sliderSegmentedControl").on('tap','a',function(){
	if($(this).attr("href")!=""){
		id = $(this).attr("href");
	}
});
$("#search").on("input",function(){
	search=$("#search").val();
	allpsData($(id+" div:eq(0)").attr("id"));
});
//监听清除按钮对象
mui('#search')[0].addEventListener('focus', function(){
　　　　mui(".mui-icon-clear")[0].addEventListener('tap',function(){
	      search="";
	      allpsData($(id+" div:eq(0)").attr("id"));
　　 　});
})
